//
//  PhotoSelectorCell.m
//  WisdomCommunity
//
//  Created by Yahaong on 16/7/29.
//  Copyright © 2016年 zonten. All rights reserved.
//

#import "PhotoSelectorCell.h"
#import "YHMarcros.h"

@interface PhotoSelectorCell ()
@property(nonatomic, strong)UIButton *addButton;
@end
@implementation PhotoSelectorCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.contentView.backgroundColor= [UIColor greenColor];
    [self.contentView addSubview:self.addButton];
    [self.addButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
}

- (UIButton *)addButton
{
    if (!_addButton ) {
        _addButton = [[UIButton alloc]init];
        [_addButton setBackgroundImage:[UIImage imageNamed:@"邻里互动7_4"] forState:UIControlStateNormal];
    }
    return _addButton;
}

- (void)setImage:(UIImage *)image
{
    _image = image;
    if (image != nil) {
        [self.addButton setBackgroundImage:image forState:UIControlStateNormal];
        self.addButton.userInteractionEnabled = NO;
    }
    else
    {
        [self.addButton setBackgroundImage:[UIImage imageNamed:@"邻里互动7_4"] forState:UIControlStateNormal];
        self.addButton.userInteractionEnabled = YES;
    }
}
@end
